package com.usian.utils.common;

import java.io.*;

public class FileUtils {

    /**
     * 重资源流中读取第一行内容
     * @param in
     * @return
     * @throws IOException
     */
    public static String readFristLineFormResource(InputStream in) throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(in));
        return br.readLine();
    }
    
    /**
     * byte数组转文件
     *
     * @param bFile    byte数组
     * @param fileDest 转以后的文件的路径
     */
    public static  void writeBytesToFileClass(byte[] bFile,String fileDest){
        FileOutputStream fileOutputStream =null;
        
        try {
            fileOutputStream=new FileOutputStream(fileDest);
            fileOutputStream.write(bFile);
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (fileOutputStream!=null){
                try {
                    fileOutputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

}
